﻿using ET.DBCommon.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using ET.DBCommon;
using System.Drawing.Printing;
using System.IO;
using System.Drawing;
using System.Data;
using ET.DBCommon.DAL;
using System.Configuration;
using System.Text.RegularExpressions;

namespace ET.ScoreTeacherClient.Views
{
    /// <summary>
    /// PrintWindow.xaml 的交互逻辑
    /// </summary>
    public partial class PrintWindow : Window
    {
        public PrintWindow(ExamResultsModel ExamResultsModel)
        {
            InitializeComponent();
            examResultsModel = ExamResultsModel;
        }

        private int QuestionID { get; set; }
        ExamresultsTestQuestionModel examresultsTestQuestion = new ExamresultsTestQuestionModel();
        ExamresultsTestQuestionTaskStepModel examteststep = new ExamresultsTestQuestionTaskStepModel();

        public List<ExamresultsTestQuestionTaskStepModel> StepModels { get; set; }
        public string[] StopsRunningTrain { get; set; }
        ExamResultsModel examResultsModel = new ExamResultsModel();
        List<String> TestQuestionTaskStepID = new List<string>();
        List<String> StepDescribe = new List<string>();
        List<String> ExecState = new List<string>();

        /// <summary>
        /// 试卷步骤打印
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Achievement_Click(object sender, RoutedEventArgs e)
        {
            PrintDocumentPrint(1);
        }
        /// <summary>
        /// 试卷成绩打印
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void TotalScore_Click(object sender, RoutedEventArgs e)
        {
            decimal TestperTotal = 0;

            var user = UserInfoDAL.SelectUserInfo(examResultsModel.UserID);
            Dictionary<string, string> dic = new Dictionary<string, string>();
            dic["VenueNumber"] = ConfigurationManager.AppSettings["NowSession"]; //实操二
            dic["PlayerID"] = user.UserName;
            dic["TestQuestionNumber"] = examResultsModel.Describe;
            var pretotal = PreTotalDescribe(examResultsModel.ID);
            if (pretotal == null|| pretotal=="")
            {
                pretotal = "0";
            }
            var stepscore = ExamResultsDAL.SeclectTotalDescribe(examResultsModel.ID);
            if (stepscore != "0")
            {
                string[] stringSeparators = new string[] {" "};
                string[] result = stepscore.Split(stringSeparators, StringSplitOptions.None);
                stepscore = result[(result.Count()-1)];
                stepscore = stepscore.Trim();
            }
            if (examResultsModel.ExamresultsTestQuestions.Count > 1)
            {
                ExamresultsTestQuestionDAL.SetTestpaperTotal(examResultsModel.ExamresultsTestQuestions[1], out TestperTotal);
                var tal = stepscore;
                if (tal.ToString().Length > 5)
                {
                    if (examResultsModel.ExamresultsTestQuestions[1].TrainLateCount + examResultsModel.ExamresultsTestQuestions[1].StopsRunningCount
                       + examResultsModel.ExamresultsTestQuestions[1].TrainSuspendCount > 30)
                    {
                        dic["Achievement"] = stepscore;
                    }
                    else
                    {
                        dic["Achievement"] = stepscore;
                    }

                }
                else
                {
                    if (examResultsModel.ExamresultsTestQuestions[1].TrainLateCount + examResultsModel.ExamresultsTestQuestions[1].StopsRunningCount
                      + examResultsModel.ExamresultsTestQuestions[1].TrainSuspendCount > 30)
                    {
                        dic["Achievement"] = stepscore;
                    }

                    else
                    {
                        dic["Achievement"] = stepscore;
                    }
                        
                }
                dic["Time"] = ExamResultsDAL.SeclectAlltime1(examResultsModel.ID).ToString();
                PrintTranscripts.PrintInit frm = new PrintTranscripts.PrintInit("singleScore", dic);
                frm.Show();
                PrintDocumentPrint(2);
            }
            else
            {
                ExamresultsTestQuestionDAL.SetTestpaperTotal(examResultsModel.ExamresultsTestQuestions[0], out TestperTotal);
                var tal = ((decimal)65 * examResultsModel.ExamresultsTestQuestions[0].StepScore / TestperTotal);
                decimal StopsRunningCount = 0;
                decimal TrainLateCount = 0;
                decimal TrainSuspendCount = 0;
                if (examResultsModel.ExamresultsTestQuestions[0].StopsRunningCount > 15)
                {
                    StopsRunningCount = 15;
                }
                else
                {
                    StopsRunningCount = examResultsModel.ExamresultsTestQuestions[0].StopsRunningCount;
                }

                if (examResultsModel.ExamresultsTestQuestions[0].TrainLateCount > 35)
                {
                    TrainLateCount = 35;
                }
                else
                {
                    TrainLateCount = examResultsModel.ExamresultsTestQuestions[0].TrainLateCount;
                }
              
                        
                if (examResultsModel.ExamresultsTestQuestions[0].TrainSuspendCount > 35)
                {
                    TrainSuspendCount = 35;
                }
                else
                {
                    TrainSuspendCount = examResultsModel.ExamresultsTestQuestions[0].TrainSuspendCount;
                }
                

                dic["Achievement"] = (85- StopsRunningCount- TrainLateCount- TrainSuspendCount+ PassenergerPointDAL.SelectPoint(examResultsModel.ID)).ToString() ;
                dic["Time"] = ExamResultsDAL.SeclectAlltime1(examResultsModel.ID).ToString();
                PrintTranscripts.PrintInit frm = new PrintTranscripts.PrintInit("MultipleScore", dic);
                frm.Show();
                PrintDocumentPrint(2);
            }
            
           
        }
        /// <summary>
        /// 扣分步骤打印
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Composite_Click(object sender, RoutedEventArgs e)
        {
            PrintDocumentPrint(3);
        }

        /// <summary>
        /// 迫停详情打印
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ForcedStop_Click(object sender, RoutedEventArgs e)
        {
            PrintDocumentPrint(4);
        }
        /// <summary>
        /// 晚点详情打印
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Late_Click(object sender, RoutedEventArgs e)
        {
            PrintDocumentPrint(5);
        }
        /// <summary>
        /// 停运详情打印
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Outage_Click(object sender, RoutedEventArgs e)
        {
            PrintDocumentPrint(6);
        }

        string upFildName = "";//存储本地pdf路径
                               /// <summary>
                               /// 调用PrintController和printDocument生成PDF文件
                               /// </summary>
        void PrintDocumentPrint(int num)
        {
            List<string> PrintS = new List<string>();
            //PrintController：控制一个PrintDocument是如何打印的。
            PrintDocument printDocument1 = new PrintDocument();
            //需要为当前页打印内容发生的函数
            switch (num) {
                case 1:
                    printDocument1.PrintPage += new PrintPageEventHandler(PrintDocumentPrintPage1);
                    break;
                case 2:
                    printDocument1.PrintPage += new PrintPageEventHandler(PrintDocumentPrintPage2);
                    break;
                case 3:
                    printDocument1.PrintPage += new PrintPageEventHandler(PrintDocumentPrintPage3);
                    break;
                case 4:
                    printDocument1.PrintPage += new PrintPageEventHandler(PrintDocumentPrintPage4);
                    break;
                case 5:
                    printDocument1.PrintPage += new PrintPageEventHandler(PrintDocumentPrintPage5);
                    break;
                case 6:
                    printDocument1.PrintPage += new PrintPageEventHandler(PrintDocumentPrintPage6);
                    break;

            }

            
            PrintController printController = new StandardPrintController();
            //获取或设置指导打印进程的打印控制器
            printDocument1.PrintController = printController;
            // 加入打印页面的设置处理
            //设置为PDF打印
            //printDocument1.PrinterSettings.PrinterName = "Microsoft Print to PDF";
            //printDocument1.DocumentName = "计量单.pdf";
            //try
            //{
            //    string pathName = @"C:\Users\Administrator\Desktop\打印";
            //    string fileName = @"C:\Users\Administrator\Desktop\打印\"+num+".pdf";
            //    upFildName = fileName;
            //    //string fileName = @"C:\NTPoundPDF\TestPrinting2.pdf";
            //    if (!Directory.Exists(pathName))
            //    {
            //        Directory.CreateDirectory(pathName);//在指定路径创建文件夹
            //    }
            //    if (!File.Exists(fileName))
            //    {
            //        printDocument1.PrinterSettings.PrintFileName = fileName;//设置保存文件路径和名字
            //    }

                
            //    foreach (string sPrint in PrinterSettings.InstalledPrinters)//获取所有打印机名称
            //    {
            //        PrintS.Add(sPrint);
            //    }

            //    printDocument1.PrinterSettings.PrinterName = PrintS[2];//打印机名字
            //                                                                          //是否获取或设置一个值，该值指示打印输出是否发送到文件，而不发送到端口
            //    printDocument1.PrinterSettings.PrintToFile = true;
            //    printDocument1.Print(); // 触发PrintPage事件。 
            //}
            //catch (Exception ex)
            //{

            //    //printDocument1.PrintController.OnEndPrint(printDocument1, new PrintEventArgs());
            //}
        }
        private String PreTotalDescribe(int StepId)
        {
            String sql = "SELECT * FROM examresults where ID=" + StepId;
            DataSet ds1 = DbHelper.ExecuteDataset(sql);
            if (ds1 != null && ds1.Tables.Count > 0)
            {
                for (int i = 0; i < ds1.Tables[0].Rows.Count; i++)
                {
                    string PreTotalScoreDescribe = ds1.Tables[0].Rows[i]["PreTotalScoreDescribe"].ToString();
                    return PreTotalScoreDescribe.ToString();
                }
            }
            return "0.00";

        }


        private void ExamTestquestiontaskstep(int resutlid)
        {
            String sql = "select TestQuestionTaskStepID,StepDescribe,ExecState from examresultstestquestiontaskstep where " +
                "ExamresultsTestQuestionTaskID in (Select ID from examresultstestquestiontask where ExamresultsTestQuestionID=(SELECT max(ID) " +
                "from examresultstestquestion where ExamResultsID=2)) and TaskType=2;";
            DataSet ds1 = DbHelper.ExecuteDataset(sql);
            if (ds1 != null && ds1.Tables.Count > 0)
            {
                for (int i = 0; i < ds1.Tables[0].Rows.Count; i++)
                {
                    TestQuestionTaskStepID.Add(Convert.ToInt32( ds1.Tables[0].Rows[i]["TestQuestionTaskStepID"]).ToString());
                    StepDescribe.Add(ds1.Tables[0].Rows[i]["StepDescribe"].ToString());
                    if (ds1.Tables[0].Rows[i]["ExecState"].ToString() != "")
                    {
                        ExecState.Add((ds1.Tables[0].Rows[i]["ExecState"]).ToString());
                    }
                    else
                    {
                        ExecState.Add("0");
                    }
                }
            }


        }

        /// <summary>
        /// 打印内容方法。需要打印新的一页时发生，负责打印一页所需要的数据，打印调用该事件，打印内容就是此处设置好的内容。
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"> 打印内容参数</param>
        void PrintDocumentPrintPage1(object sender, PrintPageEventArgs e)
        {
            int x = 50;//x轴位置
            int y = 240;//y轴位置
            Font TitleFont = new Font("宋体", 20, System.Drawing.FontStyle.Bold);//设置字体格式
            SolidBrush TitleBrush = new SolidBrush(System.Drawing.Color.Black);
            System.Drawing.Pen pen = new System.Drawing.Pen(System.Drawing.Color.Black, 2);//线条颜色
            try
            {
                ExamTestquestiontaskstep(examResultsModel.ID);
                for (int i=0;i< TestQuestionTaskStepID.Count; i++)
                {
                    
                }

                //分割线

                //在指定位置并且按指定大小绘制指定的 Image,
                // e.Graphics.DrawImage(iamge, 30, 30, 100, 120);

                //加文字水印
                //string text = string.Format("ZENITH");
                Font crFont = new Font("微软雅黑", 57, System.Drawing.FontStyle.Bold);
                SolidBrush semiTransBrush = new SolidBrush(System.Drawing.Color.FromArgb(60, 137, 131, 131));
                //将原点移动 到位置中点
                e.Graphics.TranslateTransform(0, 50);
                //以原点为中心 转 -45度
                e.Graphics.RotateTransform(-45);

                TestQuestionTaskStepID.Clear();
                StepDescribe.Clear();
                ExecState.Clear();
            }
            catch (Exception ee)
            {

            }
        }

        /// <summary>
        /// 打印内容方法。需要打印新的一页时发生，负责打印一页所需要的数据，打印调用该事件，打印内容就是此处设置好的内容。
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"> 打印内容参数</param>
        void PrintDocumentPrintPage2(object sender, PrintPageEventArgs e)
        {
            int x = 50;//x轴位置
            int y = 240;//y轴位置
            Font TitleFont = new Font("宋体", 20, System.Drawing.FontStyle.Bold);//设置字体格式
            SolidBrush TitleBrush = new SolidBrush(System.Drawing.Color.Black);
            System.Drawing.Pen pen = new System.Drawing.Pen(System.Drawing.Color.Black, 2);//线条颜色
            try
            {
                //e.HasMorePages = true;//开启多页打印
                System.Drawing.Image iamge = System.Drawing.Image.FromFile("C:\\Users\\Administrator\\Desktop\\成绩单.png");//加载本地图片
                //System.Drawing.Image iamge = Properties.Resources.logo2; //加载项目资源图片
                e.Graphics.DrawImage(iamge, 0, 0, 800, 1200);

                var pretotal=PreTotalDescribe(examResultsModel.ID);
                //绘制一系列连接一组 PointF 结构的线段
                e.Graphics.DrawString( pretotal, TitleFont, System.Drawing.Brushes.Black, new System.Drawing.Point(x, 200));
                e.Graphics.DrawString(examResultsModel.ExamresultsTestQuestions[0].TrainLateCount.ToString(), TitleFont, System.Drawing.Brushes.Black, new System.Drawing.Point(x, 250));
                e.Graphics.DrawString( examResultsModel.ExamresultsTestQuestions[0].StopsRunningCount.ToString(), TitleFont, System.Drawing.Brushes.Black, new System.Drawing.Point(x, 300));
                e.Graphics.DrawString( examResultsModel.ExamresultsTestQuestions[0].TrainSuspendCount.ToString(), TitleFont, System.Drawing.Brushes.Black, new System.Drawing.Point(x, 350));
                e.Graphics.DrawString( examResultsModel.ExamresultsTestQuestions[0].StopLaterScore.ToString(), TitleFont, System.Drawing.Brushes.Black, new System.Drawing.Point(x, 400));
                e.Graphics.DrawString( examResultsModel.ExamresultsTestQuestions[0].StepScore.ToString(), TitleFont, System.Drawing.Brushes.Black, new System.Drawing.Point(x,450));
                e.Graphics.DrawString((Convert.ToDecimal(pretotal) + examResultsModel.ExamresultsTestQuestions[0].TrainLateCount+ examResultsModel.ExamresultsTestQuestions[0].StopsRunningCount
                   + examResultsModel.ExamresultsTestQuestions[0].TrainSuspendCount + examResultsModel.ExamresultsTestQuestions[0].StepScore).ToString(), TitleFont, System.Drawing.Brushes.Black, new System.Drawing.Point(x, 500));
               

                //分割线

                //在指定位置并且按指定大小绘制指定的 Image,
                 

                //加文字水印
                //string text = string.Format("ZENITH");
                Font crFont = new Font("微软雅黑", 57, System.Drawing.FontStyle.Bold);
                SolidBrush semiTransBrush = new SolidBrush(System.Drawing.Color.FromArgb(60, 137, 131, 131));
                //将原点移动 到位置中点
                e.Graphics.TranslateTransform(0, 50);
                //以原点为中心 转 -45度
                e.Graphics.RotateTransform(-45);
                //for (int j = 0; j < 10; j++)
                //{
                //    e.Graphics.DrawString(text, crFont, semiTransBrush, new PointF(0 - j * 300, 100 + j * 300));
                //    e.Graphics.DrawString(text, crFont, semiTransBrush, new PointF(150 - j * 300, 500 + j * 300));
                //    e.Graphics.DrawString(text, crFont, semiTransBrush, new PointF(650 - j * 300, 600 + j * 300));
                //}
            }
            catch (Exception ee)
            {

            }
        }

        /// <summary>
        /// 打印内容方法。需要打印新的一页时发生，负责打印一页所需要的数据，打印调用该事件，打印内容就是此处设置好的内容。
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"> 打印内容参数</param>
        void PrintDocumentPrintPage3(object sender, PrintPageEventArgs e)
        {
            int x = 50;//x轴位置
            int y = 240;//y轴位置
            Font TitleFont = new Font("宋体", 20, System.Drawing.FontStyle.Bold);//设置字体格式
            SolidBrush TitleBrush = new SolidBrush(System.Drawing.Color.Black);
            System.Drawing.Pen pen = new System.Drawing.Pen(System.Drawing.Color.Black, 2);//线条颜色
            try
            {
                ExamTestquestiontaskstep(examResultsModel.ID);
                for(int i = 0; i < TestQuestionTaskStepID.Count; i++)
                {
                    if (ExecState[i] == "0")
                    {
                        continue;
                    }

                }

                TestQuestionTaskStepID.Clear();
                StepDescribe.Clear();
                ExecState.Clear();
                //加文字水印
                //string text = string.Format("ZENITH");
                Font crFont = new Font("微软雅黑", 57, System.Drawing.FontStyle.Bold);
                SolidBrush semiTransBrush = new SolidBrush(System.Drawing.Color.FromArgb(60, 137, 131, 131));
                //将原点移动 到位置中点
                e.Graphics.TranslateTransform(0, 50);
                //以原点为中心 转 -45度
                e.Graphics.RotateTransform(-45);
                //for (int j = 0; j < 10; j++)
                //{
                //    e.Graphics.DrawString(text, crFont, semiTransBrush, new PointF(0 - j * 300, 100 + j * 300));
                //    e.Graphics.DrawString(text, crFont, semiTransBrush, new PointF(150 - j * 300, 500 + j * 300));
                //    e.Graphics.DrawString(text, crFont, semiTransBrush, new PointF(650 - j * 300, 600 + j * 300));
                //}
                TestQuestionTaskStepID.Clear();
                StepDescribe.Clear();
                ExecState.Clear();
            }
            catch (Exception ee)
            {

            }
        }

        /// <summary>
        /// 打印内容方法。需要打印新的一页时发生，负责打印一页所需要的数据，打印调用该事件，打印内容就是此处设置好的内容。
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"> 打印内容参数</param>
        void PrintDocumentPrintPage4(object sender, PrintPageEventArgs e)
        {
            int x = 50;//x轴位置
            int y = 240;//y轴位置
            Font TitleFont = new Font("宋体", 20, System.Drawing.FontStyle.Bold);//设置字体格式
            SolidBrush TitleBrush = new SolidBrush(System.Drawing.Color.Black);
            System.Drawing.Pen pen = new System.Drawing.Pen(System.Drawing.Color.Black, 2);//线条颜色
            try
            {
                //e.HasMorePages = true;//开启多页打印
                //Image iamge = Image.FromFile("YCJL.UI.Resources.logo2.png");//加载本地图片
                //System.Drawing.Image iamge = Properties.Resources.logo2; //加载项目资源图片
                
                TrainSuspendDAL.GetTrainSuspendList(this.QuestionID);

                //分割线

                //在指定位置并且按指定大小绘制指定的 Image,
                // e.Graphics.DrawImage(iamge, 30, 30, 100, 120);

                //加文字水印
                //string text = string.Format("ZENITH");
                Font crFont = new Font("微软雅黑", 57, System.Drawing.FontStyle.Bold);
                SolidBrush semiTransBrush = new SolidBrush(System.Drawing.Color.FromArgb(60, 137, 131, 131));
                //将原点移动 到位置中点
                e.Graphics.TranslateTransform(0, 50);
                //以原点为中心 转 -45度
                e.Graphics.RotateTransform(-45);
                //for (int j = 0; j < 10; j++)
                //{
                //    e.Graphics.DrawString(text, crFont, semiTransBrush, new PointF(0 - j * 300, 100 + j * 300));
                //    e.Graphics.DrawString(text, crFont, semiTransBrush, new PointF(150 - j * 300, 500 + j * 300));
                //    e.Graphics.DrawString(text, crFont, semiTransBrush, new PointF(650 - j * 300, 600 + j * 300));
                //}
            }
            catch (Exception ee)
            {

            }
        }
        /// <summary>
        /// 打印内容方法。需要打印新的一页时发生，负责打印一页所需要的数据，打印调用该事件，打印内容就是此处设置好的内容。
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"> 打印内容参数</param>
        void PrintDocumentPrintPage5(object sender, PrintPageEventArgs e)
        {
            int x = 50;//x轴位置
            int y = 240;//y轴位置
            Font TitleFont = new Font("宋体", 20, System.Drawing.FontStyle.Bold);//设置字体格式
            SolidBrush TitleBrush = new SolidBrush(System.Drawing.Color.Black);
            System.Drawing.Pen pen = new System.Drawing.Pen(System.Drawing.Color.Black, 2);//线条颜色
            try
            {
                //e.HasMorePages = true;//开启多页打印
                //Image iamge = Image.FromFile("YCJL.UI.Resources.logo2.png");//加载本地图片
                //System.Drawing.Image iamge = Properties.Resources.logo2; //加载项目资源图片


                TrainLateDAL.GetTrainLateList(this.QuestionID);
                //分割线

                //在指定位置并且按指定大小绘制指定的 Image,
                // e.Graphics.DrawImage(iamge, 30, 30, 100, 120);

                //加文字水印
                //string text = string.Format("ZENITH");
                Font crFont = new Font("微软雅黑", 57, System.Drawing.FontStyle.Bold);
                SolidBrush semiTransBrush = new SolidBrush(System.Drawing.Color.FromArgb(60, 137, 131, 131));
                //将原点移动 到位置中点
                e.Graphics.TranslateTransform(0, 50);
                //以原点为中心 转 -45度
                e.Graphics.RotateTransform(-45);
                //for (int j = 0; j < 10; j++)
                //{
                //    e.Graphics.DrawString(text, crFont, semiTransBrush, new PointF(0 - j * 300, 100 + j * 300));
                //    e.Graphics.DrawString(text, crFont, semiTransBrush, new PointF(150 - j * 300, 500 + j * 300));
                //    e.Graphics.DrawString(text, crFont, semiTransBrush, new PointF(650 - j * 300, 600 + j * 300));
                //}
            }
            catch (Exception ee)
            {

            }
        }
        /// <summary>
        /// 打印内容方法。需要打印新的一页时发生，负责打印一页所需要的数据，打印调用该事件，打印内容就是此处设置好的内容。
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"> 打印内容参数</param>
        void PrintDocumentPrintPage6(object sender, PrintPageEventArgs e)
        {
            int x = 50;//x轴位置
            int y = 240;//y轴位置
            Font TitleFont = new Font("宋体", 20, System.Drawing.FontStyle.Bold);//设置字体格式
            SolidBrush TitleBrush = new SolidBrush(System.Drawing.Color.Black);
            System.Drawing.Pen pen = new System.Drawing.Pen(System.Drawing.Color.Black, 2);//线条颜色
            try
            {
                //e.HasMorePages = true;//开启多页打印
                //Image iamge = Image.FromFile("YCJL.UI.Resources.logo2.png");//加载本地图片
                //System.Drawing.Image iamge = Properties.Resources.logo2; //加载项目资源图片
                ExamResultsLogDAL.GetLateTrain(this.QuestionID);


                //分割线

                //在指定位置并且按指定大小绘制指定的 Image,
                // e.Graphics.DrawImage(iamge, 30, 30, 100, 120);

                //加文字水印
                //string text = string.Format("ZENITH");
                Font crFont = new Font("微软雅黑", 57, System.Drawing.FontStyle.Bold);
                SolidBrush semiTransBrush = new SolidBrush(System.Drawing.Color.FromArgb(60, 137, 131, 131));
                //将原点移动 到位置中点
                e.Graphics.TranslateTransform(0, 50);
                //以原点为中心 转 -45度
                e.Graphics.RotateTransform(-45);
                //for (int j = 0; j < 10; j++)
                //{
                //    e.Graphics.DrawString(text, crFont, semiTransBrush, new PointF(0 - j * 300, 100 + j * 300));
                //    e.Graphics.DrawString(text, crFont, semiTransBrush, new PointF(150 - j * 300, 500 + j * 300));
                //    e.Graphics.DrawString(text, crFont, semiTransBrush, new PointF(650 - j * 300, 600 + j * 300));
                //}
            }
            catch (Exception ee)
            {

            }
        }


    }
}
